package com.cntv.lifecycledemo.kotlin

import android.util.Log
import androidx.lifecycle.*


/**
 * Created By Mahongyin
 * Date    2020/9/16 17:01
 * 实现接口  使用注解  7种
 *
 */
class MyObserver() : LifecycleObserver {

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    fun activityStrart() {
        Log.i("mhyLog", "activityStrart");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    fun activityCreate() {
        Log.i("mhyLog", "activityCreate");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    fun activityResume() {
        Log.i("mhyLog", "activityResume");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    fun activityPause() {
        Log.i("mhyLog", "activityPause");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    fun activityStop() {
        Log.i("mhyLog", "activityStop");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    fun activityDestroy() {
        Log.i("mhyLog", "activityDestroy");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_ANY)
    fun activityAny() {
//        Log.i("mhyLog", "任何生命周期，我都回调");
    }

}